fix(relay): allow owner to delete archived channels - #2988
Open
bokiko wants to merge 1 commit into
Open
Conversation
bokiko
force-pushed
the
fix/2954-allow-delete-archived-channel
branch
2 times, most recently
from
July 26, 2026 20:18
ad2c31d to
6c5470e
Compare
Both archived-channel guards (validate_admin_event and the ingest path) exempted only kind:9002 with archived=false, so an owner's kind:9008 DELETE_GROUP on an archived channel was rejected with "channel is archived" before its owner-only authorization ever ran. The user-visible case is auto-archived huddle channels, which could never be deleted. Exempt kind:9008 at both guard sites. Authorization is unchanged: the 9008 validator arm still runs after the guard and rejects non-owners with "only owner can delete group". Adds an e2e regression test covering owner delete of an archived channel, non-owner delete still failing the owner check (not the archived guard), and the 9002 unarchive exemption staying intact. Fixes block#2954 Signed-off-by: bokiko <bokiko@gmail.com>
bokiko
force-pushed
the
fix/2954-allow-delete-archived-channel
branch
from
July 30, 2026 10:07
6c5470e to
16e9d23
Compare
Author
|
Ready for review when someone from @block/buzz-oss-team has a moment. Fixes #2954 — deleting an archived channel failed with The change exempts kind:9008 at both guards (
Happy to rebase again, split it, or move the test if you'd prefer a different shape. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Deleting an archived channel currently fails with 400
invalid: channel is archived. Two independent archived-channel guards in the relay reject every mutation on an archived channel except unarchive (kind:9002 witharchived=false), so the owner's kind:9008 delete is rejected before it ever reaches its authorization check and delete handler:crates/buzz-relay/src/handlers/side_effects.rs— the guard invalidate_admin_eventruns ahead of the per-kind auth match.crates/buzz-relay/src/handlers/ingest.rs— a second, independent rejection in the ingest path.This change exempts kind:9008 (delete — a valid terminal transition from archived state) at both guards, using the existing
KIND_NIP29_DELETE_GROUPconstant (the guard's raw9002literal is upgraded toKIND_NIP29_EDIT_METADATAin passing). Authorization is untouched: the 9008 validator arm still runs after the guard and rejects anyone who is not the owner (or the owning human of an owner-role agent), then the existing soft-delete handler runs unchanged.Related issue
Fixes #2954. Searched open PRs for duplicates — none found.
Testing
test_owner_can_delete_archived_channel(crates/buzz-test-client/tests/e2e_relay.rs): create → archive → unarchive succeeds (9002 exemption intact) → re-archive → non-owner delete rejected withonly owner can delete group(proves the auth path still runs, not the archived guard) → owner delete succeeds → post-delete unarchive fails withchannel not found(soft-delete took effect).invalid: channel is archived— exactly the reported bug.cargo fmt --all --checkandcargo clippy --workspace --all-targets -- -D warnings: clean.test_unarchive_emits_member_added_notification,test_subscription_limit_enforced) are pre-existing and reproduce identically on the unpatched build.